﻿using System.Collections.ObjectModel;
using System.Windows;
using System.Windows.Media;

namespace Dsl.Ped.Framework.Common
{
    /// <summary>
    /// Interface implemented by any container
    /// </summary>
    public interface IProjectionContainer
    {
        /// <summary>
        /// Name of the control (can be displayed in the editor, Context Menu, ...)
        /// </summary>
        string Name { get; set; }

        /// <summary>
        /// Default projection of the control
        /// </summary>
        IProjection DefaultProjection { get; }

        /// <summary>
        /// Gets the info whether the container must be refreshed when it becomes active
        /// </summary>
        bool ForceRefresh { get; set; }

        /// <summary>
        /// Transitions between all <see cref="IProjection"/> instances in this container
        /// </summary>
        ReadOnlyCollection<Transition> Transitions { get; }

        /// <summary>
        /// All <see cref="IProjection"/> projections in this container
        /// </summary>
        ReadOnlyCollection<IProjection> Projections { get; }

        /// <summary>
        /// Image representing this container
        /// </summary>
        ImageSource Image { get; }

        /// <summary>
        /// Register new <see cref="IProjection"/> to the container
        /// </summary>
        /// <param name="projectionName">Name of the projection</param>
        /// <param name="projection">Instance of the projection</param>
        /// <returns>The container for which the projection is being registered</returns>
        IProjectionContainer RegisterProjection(string projectionName, IProjection projection);

        /// <summary>
        /// Get <see cref="IProjection"/> that was registered under the given name
        /// </summary>
        /// <param name="projectionName">Name of the projection under which it was registered</param>
        /// <returns>Projection that was registered under given name</returns>
        IProjection GetProjection(string projectionName);

        /// <summary>
        /// Register a transition between two projection
        /// </summary>
        /// <param name="routedEvent">Routed event that invokes the transition</param>
        /// <param name="sourceProjection">Projection in which the routed event must be invoked</param>
        /// <param name="targetProjection">Projection which the active projection is gonna be moved to</param>
        /// <returns>The container for which the projection is being registered</returns>
        IProjectionContainer RegisterTransition(RoutedEvent routedEvent, string sourceProjection, string targetProjection);
    }
}
